Skip to content

Instantly share code, notes, and snippets.

@jgrahamc
Created March 28, 2015 17:06
Show Gist options
  • Save jgrahamc/c2536402efd4b4058520 to your computer and use it in GitHub Desktop.
Save jgrahamc/c2536402efd4b4058520 to your computer and use it in GitHub Desktop.
$(call to_n,4) = $(words ) $(if $(filter-out 4,$(words x )),$(call to_n,4,x )) # $1 == 4, $2 is blank
= 0 $(if $(filter-out 4,1),$(call to_n,4,x )) # $(filter-out 4,1) is 1
= 0 $(if 1,$(call to_n,4,x )) # So the $(call) will happen
= 0 $(call to_n,4,x )
= 0 $(words x ) $(if $(filter-out 4,$(words x x )),$(call to_n,4,x x ))
= 0 1 $(if $(filter-out 4,2)),$(call to_n,4,x x )) # $(filter-out 4,2) is 2
= 0 1 $(if 2,$(call to_n,4,x x)) # So the $(call) will happen
= 0 1 $(call to_n,4,x x)
= 0 1 $(words x x ) $(if $(filter-out 4,$(words x x x)),$(call to_n,4,x x x ))
= 0 1 2 $(if $(filter-out 4,3),$(call to_n,4,x x x )) # $(filter-out 4,3) is 3
= 0 1 2 $(if 3,$(call to_n,4, x x x )) # So the $(call) will happen
= 0 1 2 $(call to_n,4,x x)
= 0 1 2 $(words x x x ) $(if $(filter-out 4,$(words x x x x )),$(call to_n,4,x x x x ))
= 0 1 2 3 $(if $(filter-out 4,4),$(call to_n,4,x x x x )) # $(filter-out 4,4) is
= 0 1 2 3 # $(call) does not happen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment