Questions tagged [tacit-programming]

Tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition (but not λ-abstraction) instead of variables. The simplicity behind this idea allows its use on several programming languages, such as APL and J.

Wiki

Tacit programming is one of the styles possible in the J and APL programming languages, and means coding by combining functions, without reference to argument names. This idea may have been first brought up in functional programming; it's simpler than lambda calculus.

Tacit programming is also known as point-free style, or pointless programming, because of the lack of explicit arguments, or points.

Example

In J, the same sort of point-free code occurs in a function made to compute the average of a list (array) of numbers:

 avg=: +/ % #

Details: # counts the number of items in the array. +/ sums the items of the array. % divides the sum by the number of items.

Tag usage

The tag can be used for programming related questions in implementation of J and APL programming languages, Question with the tags or can also use tag . Please avoid theoretical questions on Stack Overflow.

Read more

74 questions
4
votes
1 answer

Point-free style in Template Haskell

Consider the following Template Haskell function: composeQ :: ExpQ -> ExpQ -> ExpQ composeQ = \x y -> [| $(x) . $(y) |] Is it possible to eliminate the lambda expression from the right hand side of the equation and write composeQ using point-free…
4
votes
3 answers

Write 4 : 'x&{.&.;: y' tacitly

Conor Hoekstra recently solved a Leetcode problem in APL https://youtu.be/QtvvQ7MdwKY The problem is to take the first x words from a character string y In J, using &. (Under) and ;: (Words) I can come up with a nice explicit one liner solve =. 4 :…
bob
  • 4,282
  • 2
  • 22
  • 30
4
votes
3 answers

Point-free for filter function

Does there exist a point-free function for filter function to find minimum of first element of pair in a list? for example: findMinimum xs = filter ((== minimum (map fst xs)) . fst ) xs -- example: findMinimum [(0, 0), (0, 1), (2, 2), (3, 2), (1,…
JoeChoi
  • 395
  • 1
  • 9
4
votes
3 answers

what are some of J's unique features?

I come from a background of C, Fortran, Python, R, Matlab, and some Lisp - and I've read a few things on Haskell. What are some neat ideas/examples in J or other languages from the APL family that are unique and not implemented in more common…
hatmatrix
  • 42,883
  • 45
  • 137
  • 231
4
votes
3 answers

Abstracting boxed array structures in J

I've been working on a J function for a while, that's supposed to scan a list and put consecutive copies of an element into separate, concatenated boxes. My efforts have taken me as far as the function (<;. 2) ((2&(~:/\)),1:) which tests successive…
estanford
  • 1,302
  • 1
  • 13
  • 23
4
votes
2 answers

J tacit phrase evaluation

Why does 2(*i.)5 evaluate to 0 2 4 6 8 ? It's clear that 2*i.5 does, but the () creates a hook and evaluating from right to left it seems we get (*i.)5 == 0 5 10 15 20 and 2 won't act on that list -- so where am I going wrong ?
user1202733
  • 623
  • 4
  • 10
4
votes
2 answers

J: Number of sign changes between items of list

Items of a are _1 or 1. a =: 1 _1 _1 1 _1 There are 3 sign changes in a: 1, -1, -1, 1, -1 Λ Λ Λ here and here How do I count them looplessly?
Dan Oak
  • 704
  • 1
  • 7
  • 26
4
votes
3 answers

How to rewrite the halve function in J?

in the J programming language, -: i. 5 the above function computes the halves of all integers in [0,4]. Now let's say I'd like to re-write the -: function, just for the fun of it. My best guess so far was ]&%.2 but that doesn't seem to cut it.…
nes1983
  • 15,209
  • 4
  • 44
  • 64
4
votes
2 answers

Is it possible to write tacit functions in F#

Tacit or point-free style programming allows one to create functions without regard to their arguments. Can this be done in F#?
brianegge
  • 29,240
  • 13
  • 74
  • 99
3
votes
4 answers

When I try to add a second hook/fork to this J program, I get unexpected results. Can anyone explain why?

((1&{~+/)*./\(=1&{))1 1 1 3 2 4 1 I always get Index Error. The point is to output two numbers, one that is the same as the first number in the list, the second which is the same as the number of times that number is repeated. So this much…
Nick
  • 199
  • 6
3
votes
2 answers

Why does the J phrase '(2&*~) 15 7 3 1' produce a table, and why that specific table?

(2&*~) 15 7 3 1 Above is the phrase. At the end is the trace and the final outcome. I understand that the phrase is a monad, I understand that because of ~ it has a left and right argument. The same output happens if you run '15 7 3 1(2&*) 15 7…
Nick
  • 199
  • 6
3
votes
2 answers

Currying in Haskell with 2+ arguments

I'm starting to learn Haskell so I need to understand currying also (it's the first time I've seen this technique too). I think I get how it works in some cases where the currification only "eliminates" one of the parameters. Like in the next…
moliverac8
  • 63
  • 2
  • 7
3
votes
1 answer

A way to use conjunctions and adverbs tacitly?

Here's a naive Fibonacci sequence: (,[:+/_2&{.)^:10]0 1 NB. 10 + 2 elements 0 1 1 2 3 5 8 13 21 34 55 89 And here's its explicit monadic version: 3 :'(,[:+/_2&{.)^:y 0 1' 10 0 1 1 2 3 5 8 13 21 34 55 89 The questions is: in tacit…
9214
  • 2,105
  • 11
  • 15
3
votes
4 answers

How to rewrite in point-free style with a repeating variable?

How to rewrite the following expression in point-free style? p x y = x*x + y Using the lambda-calculus I did the following: p = \x -> \y -> (+) ((*) x x) y = \x -> (+) ((*) x x) -- here start my problem = \x -> ((+) . ((*) x )) x ... ?
Jader Martins
  • 759
  • 6
  • 26
3
votes
1 answer

What do you call this functional language feature?

ok, embarrassing enough, I posted code that I need explained. Specifically, it first chains absolute value and subtraction together, then tacks on a sort, all the while not having to mention parameters and arguments at all, because of the presense…
Jimmy
  • 89,068
  • 17
  • 119
  • 137